package uk.ac.cam.juliet.zedcat.client;

/**
 *
 * @author David Piggott
 */
public class Pixel {

    private final int mX;
    private final int mY;
    private final int mIndex;

    public Pixel(int x, int y, int frameWidth) {
        mX = x;
        mY = y;
        mIndex = mY * frameWidth + x;
    }

    public Pixel(int index, int frameWidth) {
        mX = index % frameWidth;
        mY = (index - mX) / frameWidth;
        mIndex = index;
    }

    public int getX() {
        return mX;
    }

    public int getY() {
        return mY;
    }

    public int getArrayIndex() {
        return mIndex;
    }
}
